import java.util.Date;


import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.hzjx.fenci.dao.SingleWordDao;
import com.hzjx.fenci.model.SingleWord;


public class testSingleWordDao {
	//Logger log = Logger.getLogger(testSingleWordDao.class);
	
	
	
	@Test
	public void count(){
		long count;
		String hql="select count(*) from SingleWord";
		ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
		SingleWordDao swDao=(SingleWordDao)ctx.getBean("singleWordDao");
		count=swDao.countAll();
		System.out.println("count=" + count);
	}
	
	@Test
	public void insert(){
		
		SingleWord sw = new SingleWord();
		sw.setCnWord("胡");
		sw.setCnMeans("");
		sw.setEnMeans("");
		sw.setEnWord("hu");
		sw.setCnPy("hu");
		sw.setInputDate(new Date());
		sw.setInputUserName("hulei_test");
		
		ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
		SingleWordDao swDao=(SingleWordDao)ctx.getBean("singleWordDao");
		swDao.save(sw);
		
		this.count();
	}
}
